package com.qk.management.controller;

import com.qk.common.Result;
import com.qk.dto.user.UserLoginDTO;
import com.qk.management.service.UserService;
import com.qk.vo.user.UserLoginVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author lyl
 * @created 2025/10/10 16:44
 * @description
 *
 */
@Slf4j
@RestController
@RequestMapping("/login")
@SuppressWarnings("all")
public class LoginController {

    @Autowired
    private UserService userService;

    @PostMapping
    public Result login(@RequestBody UserLoginDTO userLoginDTO) {
        log.info("用户登录:username={},password={}", userLoginDTO.getUsername(), userLoginDTO.getPassword());
        UserLoginVO userLoginVO = userService.login(userLoginDTO);
        return Result.success(userLoginVO);
    }
}
